public class ThreadDemo13 {
    public static int a = 0;

    public static void main(String[] args) {
        Thread t = Thread.currentThread();
        System.out.println(t.getName());
    }
    public static void main1(String[] args) throws InterruptedException {
        for (int i = 0; i < 20; i++) {
            Thread thread = new Thread(() -> {
                System.out.println(a);
            });
            thread.start();
            thread.join();
            a++;
        }
        System.out.println("ok");
    }
}
